package cn.mistorange.mapper;


import cn.mistorange.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {

    // 插入新用户
    @Insert("INSERT INTO users (username, password, email, created_at) VALUES (#{username}, #{password}, #{email}, #{createdAt})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void insertUser(User user);

    //批量删除用户
    void deleteUser(List<Integer> ids);

    User findUserById(Integer id);

    void updateUser(User user);
/*
    // 根据ID查找用户
    @Select("SELECT * FROM user WHERE id = #{id}")
    User findUserById(Long id);

    // 根据用户名查找用户
    @Select("SELECT * FROM user WHERE username = #{username}")
    User findUserByUsername(String username);

    // 更新用户信息
    @Update("UPDATE user SET username = #{username}, password = #{password}, email = #{email} WHERE id = #{id}")
    void updateUser(User user);

    // 获取所有用户
    @Select("SELECT * FROM user")
    List<User> findAllUsers();*/
}